<?php
class Goods_model extends CI_Model {

	function get_goods_by_cate_id($cat_id)
	{
		$cat_id = intval($cat_id);
		$query = $this->db->query('SELECT * FROM '.$this->db->dbprefix('goods').' where cat_id = '.$cat_id);
		return $query->result_array();
	}
	
	function get_goods_price_by_id($goods_id)
	{
		$goods_id = intval($goods_id);
		$query = $this->db->query('SELECT shop_price FROM '.$this->db->dbprefix('goods').' where goods_id = '.$goods_id);		
		$data = $query->first_row('array');
		if($data)
		{
			return isset($data['shop_price'])?$data['shop_price']:0;
		}
		return 0;
	}
	
	function get_goods_by_id($goods_id)
	{
		$goods_id = intval($goods_id);
		$query = $this->db->query('SELECT * FROM '.$this->db->dbprefix('goods').' where goods_id = '.$goods_id);
		$data = $query->first_row('array');
		return $data;		
	}	
	
}